package com.isoft.demo.controller;

import com.isoft.demo.common.ResponseData;
import com.isoft.demo.entity.Maintenance;
import com.isoft.demo.entity.Vehicle;
import com.isoft.demo.service.MaintenanceService;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@CrossOrigin
public class MaintenanceController {
    @Resource
    private MaintenanceService maintenanceService;
    @GetMapping("/addMain")
    public ResponseData addMain(Maintenance maintenance){
        ResponseData rs = maintenanceService.addMain(maintenance);
        return rs;
    }
    @GetMapping("/updateMain")
    public ResponseData updateVehicle(Maintenance maintenance){
        ResponseData rs = maintenanceService.updateMain(maintenance);
        return rs;
    }
//    @GetMapping("/deleteVeh")
//    public ResponseData deleteMain(@Param(value = "mid") int mid){
//        ResponseData rs = vehicleService.deleteVehicle(vid);
//        return rs;
//    }
    @GetMapping( "/allMain")
    public ResponseData findAllMain(){
        ResponseData rs = maintenanceService.findAllMain();
        return rs;
    }
    @GetMapping("/byMid")
    public ResponseData findByMid(Integer mid) {
        ResponseData rs = maintenanceService.findByMid(mid);
        return rs;
    }
  }
